import axiosHttp from '@/lib/axiosHttp';

const uploadApi={
    uploadFile:function(data){
        return axiosHttp.post("/upload/",data,{
            headers: { 'Content-Type': "multipart/form-data" },
            // transformRequest: [function() {
            //     return data;
            // }],
        })
    },
    removeFile:function(id){
        return axiosHttp.delete("/annexes-files/"+id);
    }
}


const api = {
    ...uploadApi,
    getUserInfo:function(params){
        return axiosHttp.get("/users/getUserDetailsById")
    },
    /**发起流程 */
    createProcessForm:function(id){
        return axiosHttp.get("/workflow-task/create-processform",{
            params:{
                id:id,
                nwfRelationId:""
            }
        })
    },
    /**创建流程 */
    createFlow:function(params){
        return axiosHttp.post("/"+params.F_url,params,{
            headers: {'Content-Type': "application/json" },
        })
    },
    createProcess:function(params){
        return axiosHttp.post("/workflow-task/create-process",params,{
            headers: {'Content-Type': "application/json" }
        })
    },
    /**创建流程结束 */
    /**getMytaskData 获取当前流程列表数据*/
    getMytaskData:function(params){
        return axiosHttp.get("/workflow-task/my-task",{
            params:params
        })
    },
    /**获取外出流程时间天间隔 */
    getLeaveDay:function(params){
        return axiosHttp.get("/getLeaveDay",{
            params:params
        })
    },
    /**获取外出流程时间小时间隔 */
    getLeaveTime:function(params){
        http://192.168.10.143:2828/getLeaveTime?userId=5f3247a1eda33bf4a88865a53af60746&startTime=2022-08-26+00:00:00&endTime=2022-08-31+00:00:00
        //userId=839e4b1e67fad8eb2213859a4d8f2047&startTime=2022-08-17%2013:04:00&endTime=2022-08-23%2012:54:00
        return axiosHttp.get("/getLeaveTime",{
            params:params
        })
    },
    /**获取交通类型 */
    getF_VehicleOptions:function(params){
        return axiosHttp.get("/data-items/vdhicle_type/detail",{
            params:params
        })
    },
    /**获取单程往返 */
    getF_OnewayroundtripOptions:function(params){
        return axiosHttp.get("/data-items/one_way/detail",{
            params:params
        })
    },
    //计算请假时间（天）
    getLeaveDay:function (params){
        return axiosHttp.get("/getLeaveDay",{
            params:params
        }) 
    },
    //获取考勤组组长
    getGroupDetails:function (groupId){
        return axiosHttp.get("/schedualgroup/getDetails/"+groupId);
    },
    //获取考勤组所有人员
    getGroupMembers:function(groupId){
        return axiosHttp.get("/groupuser/all/"+groupId);
    },
    //获取某个人当天班次
    getSchedualTimes:function(params){
        
        return axiosHttp.get("/schedualreleation/getSchedualTimes",{params:params})
    }

}

export default api